package com.sjlh.centurylianhua.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sjlh.centurylianhua.entity.Supplier;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SupplierMapper extends BaseMapper<Supplier> {
    /**
     *查询内容：
     * supplier表的所有，
     * producttype 表的 name 起别名为 typeName 以便自动赋值 supplier 类中的 typeName 属性
     * ${ew.customSqlSegment} 传递wrapper条件的固定写法
     * */

    //分页+查询
    @Select("select supplier.*, producttype.name typeName from supplier,producttype"+" ${ew.customSqlSegment} ")
    List<Supplier> getInfoPage(Page<Supplier> page, @Param("ew") QueryWrapper<Supplier> wrapper);

    //不执行分页查询
    @Select("select supplier.*, producttype.name typeName from supplier,producttype"+" ${ew.customSqlSegment} ")
    List<Supplier> getInfo(@Param("ew") QueryWrapper<Supplier> wrapper);
}
